<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
//
//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});
Route::group(["namespace" => 'Api'], function () {
    Route::get('getInfo', 'TestController@index');
    Route::post('logout', 'TestController@index');
    Route::post('login', 'TestController@login');
});
//没有登录
Route::group(["namespace" => 'Api'], function () {
    //用户相关
    Route::group(["prefix" => 'user'], function ($router) {
        $router->post('register', 'UserController@registerUser');//账号密码注册
        $router->post('login_pass', 'UserController@loginPass');//密码登录
        $router->post('mini_login', 'UserController@miniLogin');//小程序登录

    });
});
Route::group(["namespace" => 'Api', 'prefix' => 'wechat'], function ($router) {
    $router->get('home', 'WechatController@index');//订阅消息入口
});

//不要求强制登录
Route::group(["namespace" => 'Api', 'middleware' => ['user']], function () {
    Route::group(["prefix" => 'user'], function ($router) {
    });
    Route::group(["prefix" => 'recommend'], function ($router) {
        $router->get('swiper', 'CourseController@swiperList');//swiper列表
        $router->get('water', 'CourseController@waterList');//瀑布流列表
        $router->get('detail', 'CourseController@recommendDetail');//推荐视频详情
        $router->get('normal_detail', 'CourseController@normalDetail');//普通视频详情
    });
    Route::group(["prefix" => 'course'], function ($router) {
        $router->get('campus_course_list', 'CourseController@campusCourseLists');//校区课程列表
        $router->get('lists', 'CourseController@lists');//课程列表
        $router->get('detail', 'CourseController@detail');//课程详情
        $router->get('month_or_week', 'CourseController@monthOrWeek');//加载月份或周
        $router->get('list_with_time', 'CourseController@listWithTime');//课程列表(时间筛选用于未报名显示列表)

    });
    Route::get('category/lists', 'CourseController@categoryLists');//课程分类
    Route::group(["prefix" => 'platform'], function ($router) {
        $router->get('resource', 'PlatformController@resourceList');//平台资源
        $router->get('search_campus_type', 'PlatformController@searchCampusType');//校区搜索类型
        $router->get('pouch_card_point', 'PlatformController@pouchCardPoint');//打卡范围
        $router->get('article_detail', 'PlatformController@articleDetail');//文章详情
        $router->get('qq_map_line', 'PlatformController@qqMapLine');//导航路线坐标获取
        $router->get('wechat_message_list', 'PlatformController@wechatMessageList');//订阅消息列表
        $router->get('get_map_search', 'PlatformController@getMapSearch');//获取地图搜索地点
        $router->get('benefit_list', 'PlatformController@benefitList');//公益列表
        $router->get('score_goods_list', 'PlatformController@scoreGoodsList');//积分商品列表
        $router->get('benefit_detail', 'PlatformController@benefitDetail');//公益详情
        $router->get('score_goods_detail', 'PlatformController@scoreGoodsDetail');//兑换商品详情
    });

    Route::group(["prefix" => 'campus'], function ($router) {
        $router->get('lists', 'CampusController@lists');//校区列表
        $router->get('marker_lists', 'CampusController@markerLists');//校区marker列表
        $router->get('detail', 'CampusController@detail');//校区详情
    });

});

//要求登录
Route::group(["namespace" => 'Api', 'middleware' => ['user.auth']], function () {
    Route::group(["prefix" => 'user'], function ($router) {
        $router->get('main', 'UserCenterController@userInfo');
        $router->post('save', 'UserCenterController@updateUserInfo');
        $router->post('change_role', 'UserCenterController@changeRole');//切换身份
        $router->post('logout', 'UserController@logout');
        $router->get('message_list', 'UserCenterController@messageList');//用户消息列表
        $router->get('score_list', 'UserCenterController@scoreList');//用户积分列表
        $router->post('read_message', 'UserCenterController@readMessage');//读取用户消息
        $router->post('create_benefit', 'UserCenterController@createUserBenefit');//报名公益
        $router->get('user_benefit_list', 'UserCenterController@userBenefitList');//我的公益
        $router->get('company_info', 'UserCenterController@userCompanyInfo');//用户的企业信息
    });

    Route::group(["prefix" => 'course'], function ($router) {
        $router->post('sign', 'CourseController@sign');//签到
        $router->get('gate_statics', 'CourseController@gateStatics');//签到页出勤统计
        $router->post('give_score', 'CourseController@giveScore');//观看视频获取积分
    });
    Route::group(["prefix" => 'teacher'], function ($router) {
        $router->get('info', 'TeacherController@teacherDetail');//教师详情
        $router->get('lists', 'TeacherController@lists');//教师课程列表
        $router->get('detail', 'TeacherController@detail');//教师课程详情
        $router->get('statics', 'TeacherController@statics');//我的课程统计
        $router->get('gate_statics', 'TeacherController@gateStatics');//教师课程出勤统计
        $router->post('save', 'TeacherController@save');//教师信息保存
    });

    //课程订单
    Route::group(["prefix" => 'course_order'], function ($router) {
        $router->get('first', 'CourseOrderController@firstOrder');//提交报名时加载上次报名填写的信息
        $router->get('lists', 'CourseOrderController@lists');//我的课程
        $router->post('create', 'CourseOrderController@createOrder');//报名
        $router->get('today', 'CourseOrderController@todayCourse');//今日课程/签到获取课程列表
        $router->get('statics', 'CourseOrderController@statics');//我的课程统计
        $router->get('detail', 'CourseOrderController@orderDetail');//课程订单详情
        $router->post('cancel', 'CourseOrderController@orderCancel');//取消课程订单
        $router->get('check_apply', 'CourseOrderController@checkApply');//获取用户是否报名课程
        $router->get('statics_count', 'CourseOrderController@staticsCount');//课程订单统计
        $router->get('create_check', 'CourseOrderController@createCheck');//报名前检查状态
        $router->post('leave', 'CourseOrderController@addLeave');//请假
        $router->post('submit_estimate', 'CourseOrderController@submitEstimate');//提交评价
    });
    Route::group(["prefix" => 'goods_order'], function ($router) {
        $router->get('lists', 'GoodsOrderController@lists');//兑换订单列表
        $router->post('create', 'GoodsOrderController@createGoodsOrder');//创建兑换订单
        $router->get('statics_count', 'GoodsOrderController@orderGoodStatics');//兑换订单统计
        $router->get('detail', 'GoodsOrderController@orderDetail');//兑换订单详情
        $router->post('verify', 'GoodsOrderController@verifyOrder');//核销兑换订单
    });
    Route::group(["prefix" => 'shop'], function ($router) {
        $router->get('goods_list', 'GoodsOrderController@goodsLists');//店铺商品列表
        $router->get('goods_static', 'GoodsOrderController@goodsStatics');//店铺商品统计
        $router->post('goods_update', 'GoodsOrderController@goodsUpdate');//店铺商品上下架
        $router->get('shop_static', 'GoodsOrderController@shopStatic');//用户所有店铺统计
        $router->get('all_shop_goods', 'GoodsOrderController@allShopGoods');//用户所有店铺商品列表
        $router->get('orders', 'GoodsOrderController@shopOrder');//店铺订单列表
        $router->get('order_statics', 'GoodsOrderController@shopOrderStatics');//店铺订单统计（单个店铺）
    });

    Route::group(["prefix" => 'trade'], function ($router) {
        $router->post('to_pay', 'TradeController@toPay');//去支付
    });

    Route::group(["prefix" => 'upload'], function ($router) {
        $router->post('images', 'UploadController@upload');
    });


});

